var defaultCity = '北京';
try {
  if (localStorage.city) {
    defaultCity = localStorage.city
  }
} catch (e) {
  console.log('CityState.js file 7 line ' + e.message);
}

export default {
  state: () => ({
    city: defaultCity
  }),
  mutations: {
    changeCityName: function(state, city) {
      state.city = city;
      localStorage.city = city
    }
  },
  getters: {
    cityName: function(state) {
      return '中国-' + state.city;
    }
  }
}
